var express = require('express');
var router = express.Router();

let { studentModel } = require("../models/studentModel")


router.post('/logins', async (req, res, next) => {
    let res2 = await studentModel.find({ phone: req.body.phone, password: req.body.password });

    if (res2.length > 0) {
    
        res.send({
            code: 200,
            message: '登录成功',
            data:res2
             
        })
    } else {
        res.send({
            code: 201,
            message: '账号或密码错误'
        })
    }

});
module.exports = router;